import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import java.util.logging.SimpleFormatter;

public class OrderCodeUtil {
    public static String getTwo() {
        Random rad = new Random();
        String result = rad.nextInt(10000) + "";
//        System.out.println(result);
        if (result.length() == 1) {
            result = "000" + result;
        } else if (result.length() == 2) {
            result = "00" + result;
        } else if (result.length() == 3) {
            result = "0" + result;
        }
//        System.out.println(result);
        return result;
    }

    public static void main(String[] args) {
        String date = new SimpleDateFormat("yyyyMMdd").format(new Date());
        String seconds = new SimpleDateFormat("HHmmss").format(new Date());
        System.out.println("开始-生成单号");
        for (int i = 0; i < 10000; i++) {
            System.out.println(date + "22001000" + getTwo() + "00" + seconds + getTwo());
        }
        System.out.println("结束-生成单号");
        // 2022021814521864862532894725
        // 2022021822001476640502096635
        // 2022021800001000290011365347
    }
}
